# Stage 1: Build the Slidev presentation
FROM node:18.17.1 AS builder

WORKDIR /app

# Install Slidev globally
RUN npm install -g @slidev/cli@0.48.9 --registry=https://registry.npmmirror.com/
RUN npm install -g @slidev/theme-seriph@0.25.0 --registry=https://registry.npmmirror.com/

# Copy the presentation files
COPY . .

# Build the presentation
RUN slidev build

# Stage 2: Serve the presentation with Nginx
FROM nginx:alpine

# Copy the built presentation files from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html

# Expose port 80
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]
